﻿@{
    Layout = "~/Views/Shared/_LayoutBase.cshtml";
}

<div id="body">
    <!--north头部-->
    <div id="north" class="navwrapper">
        <div id="infobar" class="navbar pull-right">
            <ul class="infonav" id="infonav">
                <li id="info_avater" class="navin" data-placement="left" data-toggle="tooltip" title="" data-original-title="我的OA账号" data-step="6" data-intro="<b style='display:block'>6、我的OA账号</b>鼠标移上显示个人账户信息。" data-position="left">
                    <a href="javascript:;" id="avatar" class="nav-item iconfont icon-user"></a>
                    <div class="info-wrap">
                        <div class="person-info-header clearfix">
                            <div class="person-info-avator">
                                <img src="~/Content/img/iconfont-gerenxinxi.png" width="60" height="60" id="loginavatar">
                            </div>
                            <div class="person-info-content">
                                <h6 class="person-info-name">
                                    <span>系统管理员</span>
                                    <div class="person-info-online">
                                        <i class="iconfont tip-1" id="online_flag">
                                            &#xe63d;
                                        </i>
                                        <div class="person-info-tip" id="on_status">
                                            <a href="javascript:;" status="1" hidefocus="hidefocus">
                                                <i class="iconfont tip-1">&#xe63d;</i>
                                                <span class="info-tip-title">在线</span>
                                            </a>
                                            <a href="javascript:;" status="2" hidefocus="hidefocus">
                                                <i class="iconfont tip-2">&#xe63c;</i>
                                                <span class="info-tip-title">忙碌</span>
                                            </a>
                                            <a href="javascript:;" status="3" hidefocus="hidefocus">
                                                <i class="iconfont tip-3">&#xe63b;</i>
                                                <span class="info-tip-title">离开</span>
                                            </a>
                                        </div>
                                    </div>
                                </h6>
                                <p class="person-info-detail">
                                    <span class="person-info-department">综合管理部</span>
                                    <span>-OA 管理员</span>
                                </p>
                                <p class="person-info-detail" title=""></p>
                            </div>
                        </div>
                        <div class="person-info-body">
                            <a href="javascript:;" id="person_info" hidefocus="hidefocus">控制面板</a>
                            <a href="javascript:;" id="logout" hidefocus="hidefocus">注销</a>
                        </div>
                    </div>
                </li>
                <li class="navin" data-step="7" data-intro="<b style='display:block'>7、搜索</b>通过“搜索”，可以快速搜索用户、菜单、工作流、通讯簿、日程安排和在线帮助。" data-position="left">
                    <a href="javascript:;" id="searchbar" class="nav-item searchbar iconfont icon-sousuo" data-placement="bottom" data-toggle="tooltip" title="" data-original-title="搜索"></a>
                </li>
                <li id="info_avater" class="navin" data-placement="left" data-toggle="tooltip" title="" data-original-title="我的OA账号" data-step="6" data-intro="<b style='display:block'>6、我的OA账号</b>鼠标移上显示个人账户信息。" data-position="left">
                    <a href="javascript:;" id="eastbar" class="nav-item iconfont icon-tixing">@{ 
                        var message_list = ViewBag.Messages as IEnumerable<RTW.OA.Models.message>;
                        if (message_list.Count() > 0) { <text>@message_list.Count()</text> }
                    }</a>
                    <div class="info-wrap">
                        <ul class="nav" style="text-align:left">
                            @foreach (var item in ViewBag.Messages as IEnumerable<RTW.OA.Models.message>)
                            {
                                <li class="nav-pill">
                                    @if (!string.IsNullOrEmpty(item.URL))
                                    {
                                        <a class="pill-bg" onclick="createTab('990','消息中心','@item.URL');readMessage('@item.MSG_ID')">@item.TITLE</a>
                                    }
                                    else
                                    {
                                        <a class="pill-bg" onclick="readMessage('@item.MSG_ID')">@item.TITLE</a>
                                    }
                                </li>
                            }
                            <li class="nav-pill" v-for="item in messages">
                                <message-item v-bind:message="item"></message-item>
                            </li>
                        </ul>
                    </div>
                </li>
                @*<li class="navin" data-step="11" data-placement="bottom" data-toggle="tooltip" title="" data-original-title="通知中心" data-intro="<b style='display:block'>11、通知中心</b>“通知中心”为您提供今日消息、事务提醒，增强网页微讯交流，支持文件分享与群发。" data-position="left">
                        <a href="javascript:;" id="eastbar" class="nav-item iconfont icon-tixing"></a>
                    </li>*@
            </ul>
        </div>
        <div id="logo" class="pull-left">
            <a href="javascript:;" onClick="javascript:createTab('portal_5', '我的桌面', '/portal/personal/', '0');">
                <!--<img src="/static/theme/15/img/logo_simple.png"/>-->
                <img src="../../Content/img/logo.png" style="margin:8px 0 0 10px;" />
            </a>
        </div>
        <div id="taskbar" class="pull-left" style="width:830px;">
            <div id="tabs_left_scroll" class="tabs-scroll scroll-left"></div>
            <div id="tabs_container" class="tabs-container" style="max-width:750px;"></div>
            <div id="tabs_right_scroll" class="tabs-scroll scroll-right"></div>
        </div>

    </div>
    <!--east 通知中心区域-->
    @*<div id="east" class="east disabled">
        <ul class="nav nav-tabs">
            <li class="nav-pill active" paneltype="today">
                <a class="pill-bg" href="javascript:void(0)" data-id="n-01" data-url="today">今日</a>
            </li>
            <li class="nav-pill" paneltype="msg">
                <a class="pill-bg" href="javascript:void(0)" data-id="n-02" data-url="message">消息</a>
            </li>
            <li class="nav-pill" paneltype="org">
                <a class="pill-bg" href="javascript:void(0)" data-id="n-03" daat-url="organization">组织</a>
            </li>
        </ul>
        <div id="east-tab" class="tab-content">
            <!--今日-->
            <div class="tab-pane pane-today active">
                <div id="datetime" class="dateArea">
                    <div title="2015年4月29日" class="weather-date" id="date">
                        <span>4月29日</span>
                        星期三
                    </div>
                    <div title="农历 三月十一" id="mdate">农历三月十一</div>
                </div>
                <div id="weatherarea" class="mod">
                    <div class="mod-hd">
                        <span class="mod-hd-title">天气</span>
                        <div class="city" style="display: none;"><i class="iconfont" id="changecity"></i></div>
                    </div>
                    <div class="mod-bd">
                        <div id="weather" class="clearfix">
                            <span style="width: 100%;text-align: center;color: #999;display: block;">未开启天气预报</span>
                        </div>
                    </div>
                </div>
                <div class="mod">
                    <div class="mod-hd">
                        <div class="mod-hd-title">日程</div>
                    </div>
                    <div class="mod-bd">
                        <ul class="calendar-list" id="cal_list">
                            <li>
                                <a class="common-font" cal_type="calendar" cal_id="42" href="javascript:;">
                                    <span class="cal_content">3wqrqwrwqr</span>
                                    <span class="pull-right">01:00</span>
                                </a>
                            </li>
                        </ul>
                        <div id="caltip" class="notip" style="display: none;">今日暂无日程</div>
                    </div>
                </div>
                <div class="mod">
                    <div class="mod-hd">
                        <div class="mod-hd-title">提醒事项</div>
                    </div>
                    <div class="mod-bd">
                        <ul class="remind_list" id="remind_list"></ul>
                        <div id="remindtip" class="notip" style="display: block;">今日暂无提醒</div>
                    </div>
                </div>
            </div>

            <!--消息-->
            <div class="tab-pane pane-msg">
                <div id="msg-tool" class="btn-group msg-tool">
                    <button class="btn btn-mini btn-primary" msg-panel="nocbox" type="button">
                        <span>事务提醒</span>
                    </button>
                    <button class="btn btn-mini" msg-panel="weixun" type="button">
                        <span>微讯</span>
                    </button>
                </div>
                <div id="nocbox" class="msg-panel active">
                    <div id="new_noc_panel" class="noc on">
                        <div id="new_noc_list" class="new_noc_list">
                            <div class="noc_item noc_item_1">
                                <div class="noc_item_title">
                                    <a title="查看全部" type_id="1" class="noc_item_read pull-right" href="javascript:;">
                                        <i class="glyphicon glyphicon-arrow-left"></i>
                                    </a>
                                    <a title="全部已阅" type_id="1" class="noc_item_cancel pull-right" href="javascript:;">
                                        <i class="glyphicon glyphicon-arrow-right"></i>
                                    </a>
                                    <span>公告通知</span>
                                </div>
                                <div class="noc_item_data">
                                    <li class="" type_id="1" url="/general/notify/show/read_notify.php?NOTIFY_ID=15" sms_id="25762" id="noc_li_25762">
                                        <a class="noc-subitem" href="javascript:;">
                                            <p class="noc_item_info">
                                                <span class="noc_item_time pull-right ">1小时前</span>
                                                <span class="name">王云</span>
                                            </p>
                                            <p class="noc_item_content">
                                                请查看公告通知！<br>标题：加快航空
                                            </p>
                                        </a>
                                    </li>
                                </div>
                            </div>
                        </div>
                        <div class="noc-nav-bar" style="display: block;">
                            <a class="viewbtn" id="ViewAllNoc" hidefocus="hidefocus" href="javascript:;">
                                <i class="iconfont icon-yiyue"></i>
                                全部已阅
                            </a>
                            <a class="viewbtn" id="ViewDetail" hidefocus="hidefocus" href="javascript:;">
                                <i class="iconfont icon-quanbu"></i>
                                查看全部
                            </a>
                            <a id="check_remind_histroy" class="noc-right" hidefocus="hidefocus" href="javascript:;">
                                <i class="iconfont icon-lishixiaoxi"></i>
                                历史消息
                            </a>
                        </div>
                    </div>
                </div>
                <div id="weixun" class="msg-panel">
                    <ul id="recentlist" class="recentlist">
                        <li>
                            <a class="recentItem" fromid="126" href="javascript:;">
                                <img class="rec_avatar" src="../../Content/img/avatar/avatar.png">
                                <div class="rec_info">
                                    <span class="rec_name">体验用户63</span>
                                    <span class="rec_time">18:13</span>
                                    <p class="rec_content"></p>
                                </div>
                            </a>
                        </li>
                    </ul>
                    <div id="rec_tips" class="rec_tips" style="display: none;">暂无最近联系人</div>
                    <div class="rec-ft">
                        <button class="btn btn-info pull-left" id="tosend" type="button">
                            <i class="iconfont icon-iconfontquanbuxiaoxizhengchang"></i>群发
                        </button>
                        <i id="refresh-rec" title="刷新" class="glyphicon glyphicon-refresh refresh pull-right"></i>
                        <i id="clear-rec" title="清空" class="glyphicon glyphicon-align-left del pull-right"></i>
                    </div>
                </div>
            </div>

            <!--组织-->
            <div class="tab-pane pane-org">
                <div id="org_tool" class="btn-group org_tool">
                    <button user-type="user_online" class="btn btn-mini online-btn btn-primary" type="button">
                        <span>在线</span>
                        <span class="user_online">6</span>
                    </button>
                    <button user-type="user_all" class="btn btn-mini online-btn" type="button">
                        <span>全部</span>
                    </button>
                </div>
                <div id="org_panel" class="org-panel">
                    <div id="user_online" class="online-panel" style="display: block;">
                        <div id="orgTree0">
                            在线
                        </div>
                    </div>
                    <div id="user_all" class="online-panel" style="display: none;">
                        <div id="orgTree1">
                            全部
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <a class="east-handle" onclick="closeEastTab()" href="javascript:void(0)">
            <i class="iconfont icon-fanhui"></i>
        </a>
    </div>*@
    <!--funcbar-->
    <div id="funcbar" class="funcbar">
        <div id="barSwitcher">
            <span class="barTitle">导航菜单</span>
            <span class="marginLeft5" onclick="adjustSize();">
                <input type="checkbox" data-toggle="switch" data-size="mini" data-label-width="14" class="undis" name="menu_config" checked />
            </span>
        </div>
        <div id="funcbar_left"></div>
    </div>
    <!--west-->
    <div id="west" class="west">
        <div id="west-body-wrapper">
            <div class="west-body">
                <div class="menu-scroll scroll-up"></div>
                <ul id="first_menu" class="first-menu" data-step="2" data-intro="<b style='display:block'>2、主菜单</b>利用“菜单导航”功能，您可以找到所需要的功能选项。" data-position="right"></ul>
                <div class="menu-scroll scroll-down"></div>
            </div>
        </div>
        <div class="west-footer">
            <ul class="ft-links clearfix">
                <li class="ft-link ft-link-icon">
                    <a href="javascript: void(0)" onclick="createTab('999','公共桌面','@Url.Action("Main","Home",new { area=""})')" class="icon glyphicon glyphicon-home" data-title="个人桌面" id="tfShowDesk"></a>
                </li>
                <li class="ft-link">
                    <a href="javascript:adjustSize();" id="handMenuWord" style="height: 22px !important;font-size: 18px;" class="west-handle" data-title="图标模式" data-step="5" data-intro="<b style='display:block'>5、图标模式</b>点击切换菜单模式。" data-position="top">
                        <i class="iconfont icon-zuo1" data-placement="top" data-toggle="tooltip" title="" data-original-title="图标模式"></i>
                        @*<i class="iconfont icon-zuo" data-placement="top" data-toggle="tooltip" title="" data-original-title="图标+文字模式"></i>*@
                    </a>
                </li>

            </ul>
        </div>
    </div>
    <!--center-->
    <div class="center" id="center">
        <div class="tosbg" id="tosbg">
            <div>
                <img src="../../Content/img/logo_tos.png" />
                <a href="javascript:void(0);" class="btn-desktop" data-title="个人桌面" id="centerShowDesk">个人桌面</a>
            </div>
        </div>
        <div id="notice_tip">
            <div id="notice_head"></div>
            <div id="notice_body"></div>
            <div id="notice_foot"></div>
        </div>
    </div>
    <!--footer-->
    <div id="south">
        <table>
            <tbody>
                <tr>
                    <td class="left"></td>
                    <td class="left">
                        <div id="new_sms"></div>
                        <span id="new_sms_sound" style="width:1px;height:1px;"></span>
                    </td>
                    <td class="center">
                        <div id="status_text">RightWay Office 2018版<br>中国协同OA软件领跑者<br>体验科技关怀   共创美好未来<br></div>
                    </td>
                    <td class="reg"></td>
                    <td style="cursor:pointer;" class="right"><div onclick="show_feedback()" title="将问题提交给开发商进行解决">问题反馈</div></td>
                    <td class="right"></td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
<template id="message_template">
    {{#if message.url != null}}
    <a v-on:click="createTab('990','消息中心',message.url);readMessage(message.data.id)" class="pill-bg">{{message.title}}</a>
    {{/else}}
    <a href="#" class="pill-bg">{{message.title}}</a>
    {{/if}}
</template>
<!-- 激光加载条(pulse bar) -->
<div id="progressBar" class="done" style="width: 60%;">
    <span id="flashBar"></span>
</div>
<input type="hidden" id="url" data-mydesk-url="@Url.Action("MyDesk","Home",new { area=""})" />
@section scripts{
    @*<script type="text/javascript" src="@Url.Content("~/Content/JS/layer/layer.js")"></script>*@
    <script type="text/javascript" src="@Url.Content("~/Content/js/common/bootstrap/bootstrap-switch.min.js")"></script>

    @*<script type="text/javascript" src="@Url.Content("~/Content/JS/common/jquery/jscrollpane/jquery.mousewheel.js")"></script>
        <script type="text/javascript" src="@Url.Content("~/Content/JS/common/jquery/jquery.ui.widget.min.js")"></script>
        <script type="text/javascript" src="@Url.Content("~/Content/JS/common/jquery/jquery.ui.autocomplete.min.js")"></script>
        <script type="text/javascript" src="@Url.Content("~/Content/JS/common/jquery/jquery.ui.tabs.min.js")"></script>*@
    <script type="text/javascript" src="@Url.Content("~/Content/js/common/publicFunction.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Content/js/common/tab.js")"></script>
    @*<script type="text/javascript" src="@Url.Content("~/Content/JS/index/tDesktop.Tabs.js")"></script>*@
    <script type="text/javascript" src="@Url.Content("~/Content/js/main.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Content/js/vue.min.js")"></script>

    <script src="@Url.Content("~/Content/js/common/signalR/jquery.signalR-2.4.0.min.js")"></script>
    <script src="@Url.Content("~/signalr/hubs")"></script>
    <script src="@Url.Content("~/Content/js/common/signalR/signalRContext.js")"></script>
    @*<script type="text/javascript" src="@Url.Content("~/Content/JS/index.js")"></script>*@
    <script type="text/javascript">
        window.onresize = function () {
            adjustSize();
        }

        var vo = new Vue({
            el: '#infonav',
            components: {
                'message-item': {
                    props: ["message"],
                    template: '#message_template'
                }
            },
            data: {
                messages: []
            }
        });

        function adjustSize() {
            try {
                var iframeW = $("#center .selected").width();
                var iframeH = $("#center .selected").height();

                for (var i = 0; i < window.frames.length; i++) {
                    $("#" + window.frames[i].name).attr("width", iframeW);
                    $("#" + window.frames[i].name).attr("height", iframeH);
                }
            } catch (e) {
            }
        }

        var readMessage = function (msgId) {
            $.post("/Home/ReadMessage", {msgId : msgId}, function (response) {
                if (response.code == 100) {
                    console.log("消息已读");
                }
            });
        }

        var context = new SignalRContext();
        context.connection("@ViewBag.User_NO");
        var msgCount = 0;

        if ($("#eastbar").text() != "") {
            msgCount = parseInt($("#eastbar").text());
        }

        //接收推送消息
        context.receiveMessage(function (message) {
            vo.messages.push(message);
            msgCount++;
            console.log(message);
            $("#eastbar").text(msgCount);
        });
    </script>

}
